package com.hang.ad.controller;

import com.hang.ad.exceptions.AdException;
import com.hang.ad.service.IAdUnitService;
import com.hang.ad.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
public class AdUnitController {
    @Autowired
    private IAdUnitService adUnitServiceImpl;

    @PostMapping("/create/unit")
    public AdUnitResponse createUnit(@RequestBody AdUnitRequest request) throws AdException {
        return adUnitServiceImpl.createUnit(request);
    }

    @PostMapping("/create/keyword")
    public AdUnitKeywordResponse createUnitKeyword(@RequestBody AdUnitKeywordRequest request) throws AdException{
        return adUnitServiceImpl.createUnitKeyword(request);
    }

    @PostMapping("/create/it")
    public AdUnitItResponse createUnitIt(@RequestBody AdUnitItRequest request) throws AdException{
        return adUnitServiceImpl.createUnitIt(request);
    }

    @PostMapping("/create/district")
    public AdUnitDistrictResponse createUnitDistrict(@RequestBody AdUnitDistrictRequest request) throws AdException{
        return adUnitServiceImpl.createUnitDistrict(request);
    }

    @PostMapping("/create/creativeUnit")
    public CreativeUnitResponse createCreativeUnit(@RequestBody CreativeUnitRequest request) throws AdException{
        return adUnitServiceImpl.createCreativeUnit(request);
    }
}
